Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update disable.ts #110

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Conversation

Peter-MJ-Parker
Copy link
Contributor

@Peter-MJ-Parker Peter-MJ-Parker commented Feb 23, 2024

Noticed a few bugs.

  1. Changed invalid import from discord.js. Implicitly had an any type for onFail.
-ReplyMessageOptions
+MessageReplyOptions
  1. Corrected the improper catching of errors by implementing try/catch blocks. Included more detailed error responses.
  2. Default reply for slash with onFail inputted was invalid because it could also be a string.

Plugin Submission Checklist

Before submitting your plugin, please ensure that you have followed the specifications below:

  • Your plugin code includes a JSDoc block with @plugin at the beginning and @end at the end.
  • The order of plugin metadata within the JSDoc block follows the structure provided:
    1. @plugin
    2. description
    3. @author (you can have multiple authors in this format: @author @jacoobes [<@182326315813306368>])
    4. @version (with the version number)
    5. @example (a nice example of how to use your plugin)
    6. @end

this is an example:

/** 
 * @plugin
 * filters autocomplete interaction that pass the criteria
 * @author @jacoobes [<@182326315813306368>]
 * @version 1.0.0
 * @example
 * ```ts
 * import { CommandType, commandModule } from "@sern/handler";
 * import { filterA } from '../plugins/filterA.js'
 * export default commandModule({
 *    type : CommandType.Slash,
 *    options: [
 *       {  
 *          autocomplete: true,
 *          command : {
 *             //only accept autocomplete interactions that include 'poo' in the text
 *             onEvent: [filterA(s => s.includes('poo'))],
 *             execute: (autocomplete) => {
 *                let data = [{ name: 'pooba', value: 'first' }, { name: 'pooga', value: 'second' }]
 *                autocomplete.respond(data) 
 *             }
 *          }
 *       }
 *    ],
 *    execute: (ctx, args) => {}
 * })
 * @end
 */

Plugin Submission Details

[Enter data here] this is optional

Additional Notes

[Include any additional information or notes you'd like to provide regarding your plugin submission.]

When running this plugin before, I got errors showing types were any or incompatible due to the import from discord.js. Then it couldn't catch the errors from setTimeout because they were being caught improperly and bot would crash. After these changes were implemented, the plugin no longer errors out.

Noticed a few bugs.
1) Changed invalid import from discord.js. Implicitly had an any type for `onFail`.
```diff
-ReplyMessageOptions
+MessageReplyOptions
```
2) Corrected the improper catching of errors by implementing try/catch blocks. Included more detailed error responses.
3) Default reply for slash with onFail inputted was invalid because it could also be a string.
Copy link
Member

@SrIzan10 SrIzan10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is interesting to say the least, good work!

@jacoobes jacoobes merged commit f5923ec into sern-handler:main Feb 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants